using System;
using System.Collections.Generic;
using System.Text;

using Cards.Util;
using Cards.GUI;

namespace Cards.Objects
{
    public class CCard
    {
        private INS_Card m_insCard;
        private int m_cardType;      //1 ==> 52
        private int m_cardValue;    //3 ==> 15
        private int m_realValue;        //1 ==> 11
        private Boolean m_play;

        public int CARDVALUE
        {
            get { return m_cardValue; }
            set { m_cardValue = value; }
        }
        public int REALVALUE
        {
            get { return m_realValue; }
            set { m_realValue = value; }
        }
        public int CARDTYPE
        {
            get { return m_cardType; }
            set { m_cardType = value; }
        }

        public INS_Card IC
        {
            get { return m_insCard; }
            set { m_insCard = value; }
        }

        public Boolean PLAY
        {
            get { return m_play; }
            set { m_play = value; }
        }

        public CCard(INS_Card _thqb, int _cardType)
        {
            m_play = false;
            this.m_insCard = _thqb;
            this.m_cardType = _cardType;
            CreateCardValue();
        }

        public void CreateCardValue(){

            if( m_cardType== Constants.BABICH 
                || m_cardType== Constants.BACHUON 
                ||m_cardType== Constants.BARO 
                || m_cardType==Constants.BACO){
                    m_cardValue = 3;
                    m_realValue = 3;
            }
            else if(m_cardType== Constants.BONBICH 
                    || m_cardType== Constants.BONCHUON
                    || m_cardType== Constants.BONRO
                    || m_cardType== Constants.BONCO){
                        m_cardValue = 4;
                        m_realValue = 4;
            }                    
            else if(m_cardType== Constants.NAMBICH
                     || m_cardType==Constants.NAMCHUON
                     || m_cardType==Constants.NAMRO
                     || m_cardType==Constants.NAMCO){
                        m_cardValue = 5;
                        m_realValue = 5;
            }       
            else if(m_cardType== Constants.SAUBICH 
                     || m_cardType==Constants.SAUBICH 
                     || m_cardType==Constants.SAUCHUON
                     || m_cardType==Constants.SAURO	
                     || m_cardType==Constants.SAUCO){
                        m_cardValue = 6;
                        m_realValue = 6;
            }
            else if(m_cardType== Constants.BAYBICH	
                     || m_cardType==Constants.BAYCHUON
                     || m_cardType==Constants.BAYRO	
                     || m_cardType==Constants.BAYCO	){
                        m_cardValue = 7;
                        m_realValue = 7;
            }
            else if(m_cardType== Constants.TAMBICH
                     || m_cardType==Constants.TAMCHUON
                     || m_cardType==Constants.TAMRO	
                     || m_cardType==Constants.TAMCO	){
                        m_cardValue = 8;
                        m_realValue = 8;
            }
            else if(m_cardType== Constants.CHINBICH
                     || m_cardType==Constants.CHINCHUON
                     || m_cardType==Constants.CHINRO	
                     || m_cardType==Constants.CHINCO	){
                        m_cardValue = 9;
                        m_realValue = 9;
            }
             else if(m_cardType== Constants.MUOIBICH
                     || m_cardType==Constants.MUOICHUON
                     || m_cardType==Constants.MUOIRO	
                     || m_cardType==Constants.MUOICO){
                        m_cardValue = 10;
                        m_realValue = Constants.GT_BLACKJACK_REALVALUE;
             }
             else if(m_cardType== Constants.BOIBICH	
                     || m_cardType==Constants.BOICHUON
                     || m_cardType==Constants.BOIRO	
                     || m_cardType==Constants.BOICO)	{
                        m_cardValue =  11;
                        m_realValue = Constants.GT_BLACKJACK_REALVALUE;
             }
             else if(m_cardType== Constants.DAMBICH	
                     || m_cardType==Constants.DAMCHUON
                     || m_cardType==Constants.DAMRO	
                     || m_cardType==Constants.DAMCO){
                        m_cardValue = 12;
                        m_realValue = Constants.GT_BLACKJACK_REALVALUE;
             }
             else if(m_cardType== Constants.GIABICH	
                     || m_cardType==Constants.GIACHUON
                     || m_cardType==Constants.GIARO	
                     || m_cardType==Constants.GIACO)	{
                        m_cardValue = 13;
                        m_realValue = Constants.GT_BLACKJACK_REALVALUE;
             }
             else if(m_cardType== Constants.ACHBICH	
                     || m_cardType==Constants.ACHCHUON
                     || m_cardType==Constants.ACHRO	
                     || m_cardType==Constants.ACHCO)	{
                        m_cardValue = 14;
                        m_realValue = Constants.GT_BLACKJACK_REALVALUE + 1;
             }
             else if(m_cardType== Constants.HAIBICH
                     || m_cardType==Constants.HAICHUON
                     || m_cardType==Constants.HAIRO
		             || m_cardType==Constants.HAICO){
                        m_cardValue = 15;
                        m_realValue = 2;
             }
        }
    }
}
